import java.util.Arrays;

public class StringExample {

    public static void main(String[] args) {
        String name = "小黑";
        String schoolName = "黑马程序员";
        System.out.println(name);
        System.out.println(schoolName);

        String a = new String("战神");
        System.out.println(a);

        char[] c = {'a', 'b', 'c'};
        String b = new String(c);
        System.out.println(b);
        System.out.println(c);
        int[] d = {1, 2, 3, 4};
        System.out.println(d);
        System.out.println(a.length());
        System.out.println(a.charAt(1));
        char[] e = a.toCharArray();
        for (int i = 0; i < e.length; i++) {
            System.out.println(e[i]);
        }
        System.out.println(Arrays.toString(e));

        System.out.println(schoolName.toCharArray());

        String k = "战神";

        System.out.println(k.equals(a));

        String aa = "abcde";
        String bb = "ABCde";

        System.out.println(bb.equals(aa));
        System.out.println(bb.equalsIgnoreCase(aa));
        System.out.println(aa.equalsIgnoreCase(bb));

        System.out.println(schoolName.substring(1, 5));
        System.out.println(schoolName.substring(3));
        System.out.println(schoolName.substring(1, 3));
        System.out.println(schoolName.substring(4));

        System.out.println(schoolName.replace("黑马", "**"));
        System.out.println(schoolName.replace('马', '*'));

        System.out.println(schoolName.replace("黑马", "**"));

        System.out.println(schoolName.contains("heima"));
        System.out.println(schoolName.contains("程序"));

        System.out.println(schoolName.startsWith("黑马"));
        System.out.println(schoolName.startsWith("黑猫"));
        System.out.println(schoolName.startsWith("黑马程序员"));

        String cc = "张三,李四,王五,赵六";
        String[] dd = cc.split(",");
        for (int i = 0; i < dd.length; i++) {
            System.out.println(dd[i]);
        }

        String ccc = "张三, .李四, .王五, .赵六";
        String[] r = ccc.split(".");
        for (int i = 0; i < r.length; i++) {
            System.out.println(r[i]);
        }

    }
}
